<%--
  Created by IntelliJ IDEA.
  User: taohj
  Date: 2014/6/29
  Time: 18:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<c:set var="menu" value="none" scope="request"></c:set>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <base href="<%=basePath%>">
    <title>政府数据开放平台</title>
    <jsp:include page="../../../commons/include.jsp"/>

    <link href="/resources/css/lib.css" rel="stylesheet">


    <style>


        tr {
            line-height: 40px;
        }

        tr > td:first-child {
            text-align: right;
            width: 100px;
            font-size: 14px;
            color: rgb(7, 68, 123);
        }

        tr > td:last-child {
            text-align: left;
            width: 500px;
            padding-left: 4px;
        }


    </style>


    <script>

        $(function () {

            $('form input[value="上传"]').on('click', function () {
                $('form input[type=file]').click();
                $("form input[name='storage']").val(131);
            });


            $('form input[type=file]').on('change', function () {
                if ($(this).val()) {
                    $(this).closest("td").find("div[action='init']").hide();
                    $(this).closest("td").find("div[action='fileUpload']").show();
                    $(this).closest("td").find("div[action='init']").hide();
                    $(this).closest("td").find("[action='fileUpload']").find('input[type=text]').val($(this).val());
                }
            });


            $('form div[action="fileUpload"] input[value="删除"]').on('click', function () {
                $(this).closest("td").find("div[action='init']").show();
                $(this).closest("td").find("div[action='fileUpload']").hide();
                $(this).closest("td").find("div[action='url']").hide();
                $(this).closest("td").find("[action='fileUpload']").find('input[type=text]').val('');
                $("form input[name='storage']").val('');
            });


            $('form div[action="fileUpload"] input[value="删除"]').on('click', function () {
                $(this).closest("td").find("div[action='init']").show();
                $(this).closest("td").find("div[action='fileUpload']").hide();
                $(this).closest("td").find("div[action='url']").hide();
                $(this).closest("td").find("[action='fileUpload']").find('input[type=text]').val('');
                $("form input[name='type']").val('');
            });


            $('form input[value="链接"]').on('click', function () {

                $(this).closest("td").find("div[action='init']").hide();
                $(this).closest("td").find("div[action='fileUpload']").hide();
                $(this).closest("td").find("div[action='url']").show();
                $("form input[name='storage']").val(132);
            });


            $('form div[action="url"] input[value="删除"]').on('click', function () {
                $(this).closest("td").find("div[action='init']").show();
                $(this).closest("td").find("div[action='fileUpload']").hide();
                $(this).closest("td").find("div[action='url']").hide();
                $(this).closest("td").find("[action='fileUpload']").find('input[type=text]').val('');
            });


        });
    </script>

</head>
<body>


<jsp:include page="../../../commons/top.jsp"/>
<div class="main">


    <jsp:include page="../../../commons/dashboardMenu.jsp"/>


    <div class="left">
        <ul>
            <li href="/front/my/dataset/list" >数据集管理</li>
            <li href="/front/my/dataset/data/list" class="active">数据管理</li>
        </ul>
    </div>

    <div class="right">


        <div style="padding-top: 60px;padding-left: 80px;"><span style="font-size: 20px;font-weight: bold;">新增数据</span></div>

        <div style="width: 100%;padding-top: 10px;" align="center">
            <form action="/front/my/dataset/data/create" method="post" enctype="multipart/form-data">

                <input type="hidden" name="storage" value="">


                <table align="center" class="updateTable">
                    <tr>
                        <td>标题:</td>
                        <td><input type="text" name="title"></td>
                    </tr>

                    <tr>
                        <td>数据:</td>
                        <td>
                            <div style="display: block" action="init">
                                <input type="file" name="file" style="display: none">
                                <input type="button" value="上传" style="width: 60px;">
                                <input type="button" value="链接" style="width: 60px; margin-left: 30px;">
                            </div>
                            <div style="display: none" action='fileUpload'>
                                <input type="text" class="form-control"
                                       style="width: 250px; display: inline; margin-top: -16px;">
                                <input type="button" class=""
                                       style="display: inline;width: 40px; height: 32px; text-align: center; margin-top: -16px;   vertical-align: middle;padding: 0px 0px 30px 0px; "
                                       value="删除">
                            </div>


                            <div style="display: none" action='url'>
                                <input type="text" name="url" class="form-control"
                                       style="width: 250px; display: inline; margin-top: -16px;">
                                <input type="button" class=""
                                       style="display: inline;width: 40px; height: 32px; text-align: center; margin-top: -16px; vertical-align: middle;padding: 0px 0px 30px 0px; "
                                       value="删除">
                            </div>
                        </td>
                    </tr>

                    <tr>
                        <td>是否公开:</td>
                        <td>
                            <input type="radio" name="visibility" dataSync='true' syncType='dictionary'
                                   dictionaryType='VISIBILITY'>
                        </td>
                    </tr>

                    <tr>
                        <td>数据集:</td>
                        <td>
                            <select name="dataset">
                                <option value="">请选择</option>
                                <c:forEach items="${datasets}" var="dataset">
                                    <option value="${dataset.id}"
                                            <c:if test="${requestScope.dataset==dataset.id}">selected="selected" </c:if> >${dataset.name}</option>
                                </c:forEach>
                            </select>
                        </td>
                    </tr>


                    <tr>
                        <td>当前版本:</td>
                        <td><input type="text" name="version"></td>
                    </tr>


                    <tr>
                        <td>唯一标识列:</td>
                        <td>
                            <input type="text" name="GUID">
                        </td>
                    </tr>


                    <tr>
                        <td>机构:</td>
                        <td>
                            <select name="org" dataSync='true' syncType='org'>
                                <option value="">请选择</option>
                            </select>

                        </td>
                    </tr>

                    <tr>
                        <td>授权信息:</td>
                        <td><input type="text" name="license"></td>
                    </tr>

                    <tr>
                        <td>标签:</td>
                        <td><input type="text" name="tags">
                        </td>
                    </tr>

                    <tr>
                        <td>简 介:</td>
                        <td><textarea name="description" rows="8" class="form-control"></textarea></td>
                    </tr>

                    <tr>
                        <td colspan="2" align="left" style="text-align: left;padding-left: 170px; padding-top: 30px">
                            <input type="submit" value="新&nbsp;&nbsp;&nbsp;增">
                        </td>
                    </tr>
                </table>


            </form>
        </div>


    </div>

</div>
<jsp:include page="../../../commons/buttom.jsp"/>
</body>
</html>
